package com.example.demo03_mvm.http;

import com.example.demo03_mvm.model.AddCartEntity;
import com.example.demo03_mvm.model.CartEntity;
import com.example.demo03_mvm.model.GoodDetailEntity;
import com.example.demo03_mvm.model.GoodsEntity;
import com.example.demo03_mvm.model.GoodsTypeEntity;
import com.example.demo03_mvm.model.UserEntity;

import io.reactivex.Observable;
import okhttp3.RequestBody;
import retrofit2.http.Body;
import retrofit2.http.GET;
import retrofit2.http.POST;
import retrofit2.http.Query;

public interface ApiService {

    @GET("goods/categoryMain")
    Observable<GoodsTypeEntity> getTypes();

    @GET("goods/category")
    Observable<GoodsTypeEntity> getGoods(@Query("parent_id")int parent_id);

    @GET("goods/info?category_id=0")
    Observable<GoodsEntity> getGoodList(@Query("currentPage")int currentPage,@Query("pageSize")int pageSize);

    @GET("goods/detail")
    Observable<GoodDetailEntity> getGoodDetail(@Query("goods_id")int goods_id);

    @POST("user/register")
    Observable<UserEntity> register(@Body RequestBody body);
    @POST("user/loginjson")
    Observable<UserEntity> login(@Body RequestBody body);

    @POST("goods/addCar")
    Observable<AddCartEntity> addCart(@Body RequestBody body);

    @GET("goods/selectCar")
    Observable<CartEntity> getCarts();

    @POST("goods/deleteCar")
    Observable<AddCartEntity> deleteCart(@Body RequestBody body);
}
